package org.jeecg.modules.chg.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.chg.entity.ChgArrears;
import org.jeecg.modules.chg.entity.ChgFees;
import org.jeecg.modules.chg.entity.ChgPayments;
import org.jeecg.modules.chg.entity.ChgSubFees;
import org.jeecg.modules.chg.vo.ChgChargeFeeVo;
import org.jeecg.modules.chg.vo.ChgFeeCountVo;
import org.jeecg.modules.chg.vo.ChgFeePrintVo;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 收费记录
 * @Author: jeecg-boot
 * @Date:   2022-02-21
 * @Version: V1.0
 */
public interface IChgFeesService extends IService<ChgFees> {

	/**
	 * 添加一对多
	 *
	 */
	public void saveMain(ChgFees chgFees,List<ChgSubFees> chgSubFeesList) ;

	/**
	 * 修改一对多
	 *
	 */
	public void updateMain(ChgFees chgFees,List<ChgSubFees> chgSubFeesList);

	/**
	 * 删除一对多
	 */
	public void delMain (String id);

	/**
	 * 批量删除一对多
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);


	/**收费*/
	public Result<?> charge(ChgChargeFeeVo chargeFeeVo);

	/**微信预存*/
	public ChgPayments storedPreCharge(ChgChargeFeeVo chargeFeeVo,JSONObject orderObj);

	/**微信收费*/
    Result<?> mpCharge(ChgChargeFeeVo chargeFeeVo, ChgPayments chgPayments, ArrayList arrearIds);

    @Transactional
    Result<?> mpHeXiaoCharge(ChgPayments chgPayments);

    @Transactional
	JSONObject abcHeXiaoCharge(JSONObject cacheMemObj);

    @Transactional
	public  Result<?> storedCharge(ChgArrears arrear);

	/**
	 * 设置首页数据动态更新
	 * @param type 哪一类
	 * @param key  哪一个
	 * @param val  增加值
	 */
    public void setIndexData(String type, String key, Object val,Boolean isSend);

    /**取消收费*/
	public Result<?> cancelCharge(ChgChargeFeeVo chargeFeeVo);

	/**根据缴费取消收费*/
    @Transactional
    Result<?> cancelChargeByPay(ChgPayments chgPayments);

    /**收费票据打印后提交**/
	public Result<?> printBillSubmit(JSONObject billData,List<ChgFeePrintVo> feePrintvoLs);

	/**退费-退还预存*/
	public Result<?> returnFee(ChgChargeFeeVo chargeFeeVo);

	/***根据缴费ID查询未开票的收费记录*/
	public List<ChgFees> noOpenBillFees(String paymentId);

	/**作废已打印票据*/
	public Result<?> printVoidBill(JSONObject billData);

    /**费用减免*/
	public Result<?> deratefeeBill(JSONObject billData);
	/**费用减免-违约金*/
	public Result<?> deratePenalty(JSONObject billData);

	public Result<?> keyUniteCharge(ChgChargeFeeVo chargeFeeVo);

	public Result<?> indexData(ChgChargeFeeVo chargeFeeVo, LoginUser sysUser);

	/**定时任务处理 预支付*/
	public void feePrePayOrderState();

	/**收费汇总*/
    List<ChgFeeCountVo> chargeFeeCount(String beginDate,String endDate);
}
